import React from 'react'
import PropTypes from 'prop-types'
import { withStyles } from 'material-ui/styles'

import style from './style/recent_item'

import CommonItem from './commen_item'

const RecentTopics = (props) => {
  const { topics, classes } = props
  return (
    <div className={classes.topics}>
      { topics && topics.length ?
        topics.map(item => <CommonItem topic={item} key={item.id} />) : null
      }
    </div>
  )
}
export default withStyles(style)(RecentTopics)

RecentTopics.propTypes = {
  topics: PropTypes.arrayOf(Object),
  classes: PropTypes.objectOf(Object),
}
